/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Informática
 */
@Entity
@Table(name = "adm_permiso")
@NamedQueries({
    @NamedQuery(name = "AdmPermiso.findAll", query = "SELECT a FROM AdmPermiso a")})
public class AdmPermiso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ape_id")
    private Integer apeId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ape_fecha_inicio")
    @Temporal(TemporalType.DATE)
    private Date apeFechaInicio;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ape_fecha_fin")
    @Temporal(TemporalType.DATE)
    private Date apeFechaFin;
    @Size(max = 64)
    @Column(name = "ape_motivo")
    private String apeMotivo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ape_anio_inicio")
    private int apeAnioInicio;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ape_anio_fin")
    private int apeAnioFin;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ape_tipo")
    private int apeTipo;
    @JoinColumn(name = "ame_id", referencedColumnName = "ame_id")
    @ManyToOne(fetch = FetchType.LAZY)
    private AdmMedico admMedico;

    public AdmPermiso() {
    }

    public AdmPermiso(Integer apeId) {
        this.apeId = apeId;
    }

    public AdmPermiso(Integer apeId, Date apeFechaInicio, Date apeFechaFin, int apeAnioInicio, int apeAnioFin, int apeTipo) {
        this.apeId = apeId;
        this.apeFechaInicio = apeFechaInicio;
        this.apeFechaFin = apeFechaFin;
        this.apeAnioInicio = apeAnioInicio;
        this.apeAnioFin = apeAnioFin;
        this.apeTipo = apeTipo;
    }

    public Integer getApeId() {
        return apeId;
    }

    public void setApeId(Integer apeId) {
        this.apeId = apeId;
    }

    public Date getApeFechaInicio() {
        return apeFechaInicio;
    }

    public void setApeFechaInicio(Date apeFechaInicio) {
        this.apeFechaInicio = apeFechaInicio;
    }

    public Date getApeFechaFin() {
        return apeFechaFin;
    }

    public void setApeFechaFin(Date apeFechaFin) {
        this.apeFechaFin = apeFechaFin;
    }

    public String getApeMotivo() {
        return apeMotivo;
    }

    public void setApeMotivo(String apeMotivo) {
        this.apeMotivo = apeMotivo;
    }

    public int getApeAnioInicio() {
        return apeAnioInicio;
    }

    public void setApeAnioInicio(int apeAnioInicio) {
        this.apeAnioInicio = apeAnioInicio;
    }

    public int getApeAnioFin() {
        return apeAnioFin;
    }

    public void setApeAnioFin(int apeAnioFin) {
        this.apeAnioFin = apeAnioFin;
    }

    public int getApeTipo() {
        return apeTipo;
    }

    public void setApeTipo(int apeTipo) {
        this.apeTipo = apeTipo;
    }

    public AdmMedico getAdmMedico() {
        return admMedico;
    }

    public void setAdmMedico(AdmMedico admMedico) {
        this.admMedico = admMedico;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (apeId != null ? apeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AdmPermiso)) {
            return false;
        }
        AdmPermiso other = (AdmPermiso) object;
        if ((this.apeId == null && other.apeId != null) || (this.apeId != null && !this.apeId.equals(other.apeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.apli.haiam.ejb.entidades.AdmPermiso[ apeId=" + apeId + " ]";
    }
    
}
